package com.my.interview.lock;

/**
 * 不使用Lock锁，多线程访问时，不顺序执行
 */
public class WithoutLockTest implements Runnable{


    private void get(){
        System.out.println(Thread.currentThread().getId());
        set();
    }

    public void set(){
        System.out.println(Thread.currentThread().getId());
    }

    @Override
    public void run() {
        get();
    }


    public static void main(String[] args) {

        WithoutLockTest test = new WithoutLockTest();
        new Thread(test).start();
        new Thread(test).start();
        new Thread(test).start();
    }
}
